package com.ebt.m.wiki;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

import com.ebt.m.R;
import com.ebt.m.data.bean.Brand;
import com.ebt.m.commons.buscomponent.listview.IView;

/**
 * Created by wanglu on 2017/10/18.
 */

public class SectionSearchHistoryBrand extends IView  {
    TextView text;
    Brand brand;

    public SectionSearchHistoryBrand(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        inflate(context, R.layout.product_selection_item_4_keyword, this);
        text = findViewById(R.id.text);

    }

    public SectionSearchHistoryBrand(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public SectionSearchHistoryBrand(Context context) {
        this(context, null);
    }

    @Override
    public void update(Object... args) {
        brand = (Brand) args[0];
        text.setText(brand.getBrandShortName());
        text.setOnClickListener(view -> {
            if(mOnclickListner != null) {
                mOnclickListner.onClick(view, brand);
            }
        });
    }

}
